@import (reference) 'config';
@import (reference) 'icons';
@import (reference) '../../less/typography.less';

w-container-alert-notification {
  display: flex;
  width: 310px;
  flex-direction: column;

  &.welcome-notifications {
    position: absolute;
    right: 16px;
    bottom: 16px;
  }

  .notification {
    position: relative;
    width: 100%;
    margin-top: 10px;
    padding: 16px 21px;
    background: @color-white;
    box-shadow: @shadow-notification;
    border-radius: @border-radius;
    overflow: hidden;

    &.error {
      .content-wrapper {
        margin-top: 10px;

        .content-body {
          word-break: break-all;
          max-height: 92px;
          overflow: auto;
          display: block;
          margin-right: -14px;
          padding-right: 10px;
        }
      }

      & [w-notification-action] {
        cursor: pointer;
        color: @color-error-500;
        text-decoration: underline;

        &::after {
          content: '→';
          display: inline-block;
          font-size: inherit;
          margin-left: 3px;
          text-decoration: none;
        }

        &:hover {
          text-decoration: none;
        }
      }
    }

    span.line {
      display: block;

      &:first-child {
        margin-top: 10px;
      }
    }

    .icon-close {
      top: 0;
      right: 0;
    }

    &:before {
      content: '';
      display: block;
      position: absolute;
      top: 0;
      left: 0;
      width: 5px;
      height: 100%;
    }

    &.info:before {
      background-color: @color-submit-300;
    }

    &.success:before {
      background-color: @color-success-400;
    }

    &.warn:before {
      background-color: @color-warning-600;
    }

    &.error:before {
      background-color: @color-error-500;
    }

    [ng-click] {
      cursor: pointer;
    }
  }
}

.notifications {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 10000;
}

// Top notifications
.notifications-top {
  width: 100%;
  min-width: 320px;
  position: absolute;
  top: 0;
  left: 0;
  height: 0;
  overflow: visible;

  w-container-alert-notification {
    width: 100%;
    flex-direction: row;
    align-items: center;

    .notification {
      display: flex;
      justify-content: center;
      align-items: center;
      color: @color-white;
      border-radius: 0;
      box-shadow: none;
      margin: 0;
      padding: 10px;
      min-height: 40px;
      max-height: 200px;
      overflow-y: auto;

      .icon-close {
        background: @notification-icon-close center no-repeat;
        width: 40px;
        height: 40px;
        padding: 7px;
        position: fixed;
        top: 0;
        right: 0;
        opacity: .5;
        transition: .3s;
        z-index: 2;
      }

      &:hover {
        .icon-close {
          opacity: 1;
        }
      }

      span.content-body {
        display: block;
        align-items: center;
        justify-content: center;
        font-size: 15px;
        color: @white-only;
        padding: 0 27px 0 44px;
        position: relative;
        max-height: calc(100% ~'- 40px');

        @media screen and(max-width: 480px) {
          font-size: @font-size-caption-1;
          line-height: normal;
        }

        &::before {
          content: '';
          display: inline-block;
          width: 22px;
          height: 22px;
          min-width: 22px;
          position: absolute;
          left: 0;
          margin-left: 10px;
          top: 50%;
          transform: translateY(-50%);
        }

        a {
          color: @white-only;
          text-decoration: underline;
          word-break: break-all;
        }
      }

      &.info {
        background-color: @color-submit-300;
        span.content-body:not(.no-icon)::before {
          background: @notification-icon-info center left no-repeat;
        }
      }

      &.success {
        background-color: @color-success-400;
        span.content-body:not(.no-icon)::before {
          background: @notification-icon-success center left no-repeat;
        }
      }

      &.warn {
        background-color: @color-warning-600;
        span.content-body:not(.no-icon)::before {
          background: @notification-icon-warning center left no-repeat;
        }
      }

      &.error {
        background-color: @color-error-500;
        span.content-body:not(.no-icon)::before {
          background: @notification-icon-error center left no-repeat;
        }
      }
    }
  }
}

@media screen and (min-width: 480px) {
  w-container-alert-notification {
    width: 330px;
  }
}
